﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form2 : Form
    {
        static bool done;    // Static fields are shared between all threads
        static int num;
        public Form2()
        {
            InitializeComponent();
            num = 0;
            var t = new Thread(Go);
            t.Name = "1111";
            t.Start();


            var t2 = new Thread(Go2);
            t2.Name = "2222";
            t2.Start();

            var ss = "";
        } 

        static void Go()
        {
            if (!done) { done = true; Console.WriteLine("Done"); }
        }

        static void Go2()
        {
            for (int i = 0; i < 100; i++)
            {
                num += i;
                Thread.Sleep(1000);
            }
        }
    }
}
